import kotlin.reflect.KProperty

class PoliteString(var content: String) {
    operator fun getValue(thisRef: Any?, property: KProperty<*>) =
        content.replace("stupid", "s*****")

    operator fun setValue(thisRef: Any, property: KProperty<*>, value: String) {
        content = value
    }
}

var comment: String by PoliteString("Some nice message")
println(comment)
comment = "This is stupid"
println(comment)
println("comment is of length: ${comment.length}")